<?php
session_start();
include "config/identitas-situs.php";
include "config/koneksi.php";
if (isset($_SESSION[user])){
	$query = mysql_query("SELECT * FROM com_user WHERE username = '$_SESSION[user]'");
	$data = mysql_fetch_array($query);
?>

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Halaman Administrator <?php echo $title; ?></title>
<link rel="shortcut icon" href="images/fav.ico" />
<link href="config/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
 <div id="lebar-web">
	<div id="header">
		<div class="header-judul"><?php echo $namasitus; ?></div>
		<div class="header-deskripsi"><font size="4" color="44e0bd"> Halaman Administrator </font><br><br>
		<center><img src="images/smk_kebumen.jpg" height="50px"/></center>
		<b><font size="4" color="87dbf0"><marquee behavior>
		Halaman ini hanya dapat diakses oleh admin Website Penerimaan Peserta Didik Baru (PPDB) SMK Negeri 1 Kebumen. <br></marquee>
		</font></div><br>

<?php
$pass = md5($_POST['password']);
if(isset($_POST['username']))
{
	if($_POST['username']=="" or $_POST['password']==""){
		echo "<script>alert('silahkan isi kolom yang kosong dulu..!');location.href='ubah_password.php';</script>";
		exit();
	
		}
		$sql="UPDATE com_user SET password='$pass' WHERE user_id='$_POST[id]' ";

	mysql_query($sql);
	echo "<script>window.location='index.php';</script>";
}
else {
	unset($_POST['username']);
}
?>
	<ul id="menu_nav" class="Blue">
		<li class="button"><a href="index.php">Beranda</a></li>
		<li class="button"><a href="index.php?halaman=full-siswa">Pendaftar</a></li>
		<li class="button"><a href="index.php?halaman=urut-siswa">Pendaftar Diterima</a></li>
		<li class="button"><a href="index.php?halaman=daftar-proli">Daftar Proli</a></li>
       	<li class="button"><a href="ubah_password.php">Ubah Kata Sandi</a></li>
		<li class="button"><a href="logout.php">Keluar</a></li>
	 </ul>
  <div id="isi">
 <style type="text/css">
    </style>

<fieldset style="border:3px solid #76c5ee; width:300px" align="center">
<legend style="font-weight:bold; color:#0066CC" align="center">
Ganti Kata Sandi
</legend>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table border="0" id="" align="center" width="700px">
  <tr>
  	<td colspan="2" width="150px" > <font size="2"> Nama User </td>
	<td>:</td>
	<td ><input name="username" type="text" id="username" value="<?php echo $data['username']; ?>" size="50" /></td>
  </tr>
  <tr><td></td></tr>
  <tr><td></td></tr>
  <tr>
   	<td colspan="2" width="150px" > <font size="2"> Kata Sandi </td>
	<td>:</td>
	<td><input name="password" type="password" id="password" size="50" />
	  <input name="id" type="hidden" id="id" value="<?php echo $data['user_id']; ?>" /> 
		<font size="1">* masukan kata sandi baru</td>
	</tr>
	<tr><td></td></tr>
	<tr><td></td></tr>
 <tr>
 	<td colspan="4" align="center">
		<input type="submit" value="Ganti" />	
		
 </tr>
</table>
</form>
</fieldset>
</div>
	<div style="clear:both" />
 	<div id="footer" align="center"><?php echo $namasitus; ?> <br><br>&copy; 2014. Copyrigt by: <a href="author.php">Lulu Infajaroh</a>
	<a href="#header" title="Kembali ke Atas"><img src="images/go-top.png" style="float:right; width:15px; height:15px;" /></a></div>
 </div>
<?php } ?>
</body>
</html>
